﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using QLMB.Models;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace QLMB.ViewModels
{
    public class CheckIn
    {
        private List<SelectListItem> _tp = new List<SelectListItem>();

        [DisplayName("Ho")]
        [Required(ErrorMessage = "Vui long nhap Ho")]
        public string Ho { get; set; }

        [DisplayName("Ten")]
        [Required(ErrorMessage = "Vui long nhap Ten")]
        public string Ten { get; set; }


        //[DisplayName("CMND")]
        //[RegularExpression("^(\\+[1-9][0-9]*(\\([0-9]*\\)|-[0-9])?[0]?[1-9][0-9\\- ]*$", ErrorMessage = "Chỉ được phép nhập số")]        
        //public string CNMD { get; set; }

        [DisplayName("Noi Di")]
        [Required(ErrorMessage = "Vui long chon noi di")]
        public string NoiDi { get; set; }

        [DisplayName("Ma Ve")]
        //[Required(ErrorMessage = "Vui long Nhap Ma Ve")]
        public string MaVe { get; set; }

        [DisplayName("Chuyen Bay")]
        //[Required(ErrorMessage = "Vui long Nhap Chuyen Bay")]
        public string ChuyenBay { get; set; }

        [DisplayName("Ngay di")]
        [Required(ErrorMessage = "Vui long chon ngay di")]
        public string NgayDi { get; set; }

        public List<SelectListItem> Tp
        {
            get
            {
                var db = new BookingEntities();
                IEnumerable<SelectListItem> items = db.DUONGBAYs
                  .Select(c => new SelectListItem
                  {
                      Value = c.SANBAY.MaSB,
                      Text = c.SANBAY.THANHPHO.TenTP
                  }).Distinct();
                _tp = items.ToList();
                return _tp;
            }
        }

    }
}